#include <iostream>
#include <ctemplate/template.h>
#include <string>
using namespace std;

int main()
{
    string in_html = "./test.html";
    string value = "测试ctemplate";

    // 形成数据字典
    ctemplate::TemplateDictionary root("test"); // unordered_map<> map
    root.SetValue("key1", value); // map.insert({})

    ctemplate::Template *tpl = ctemplate::Template::GetTemplate(in_html, ctemplate::DO_NOT_STRIP);
    if (tpl == nullptr) {
        cout << "template is null" << endl;
        return -1;
    }

    // 添加字典数据
    string out_html;
    tpl->Expand(&out_html, &root);
    // 完成渲染
    cout << out_html << endl;

    return 0;
}